package org.smartagents.test.brain;

import org.smartagents.body.Brain;
import org.smartagents.body.Neurone;
import org.smartagents.body.BrainBuilder;

/**
 * neurone 1 ()
 *      neurone 2 (H)
 *          neurone 3 ()
 *      neurone 4 (A)
 *          neurone 5 (H)
 *      neurone 6
 */

public class BrainTest1 {

    public static void main(String[] args) {
        Brain brain = new Brain();
        Neurone cortex = brain.getCortex();

        Neurone neurone1 = neuroneBuilder("N1");
        Neurone neurone2 = neuroneBuilder("N2");
        Neurone neurone3 = neuroneBuilder("N3");
        Neurone neurone4 = neuroneBuilder("N4");
        Neurone neurone5 = neuroneBuilder("N5");
        Neurone neurone6 = neuroneBuilder("N6");

        cortex.addLink(neurone1);
        cortex.addLink(neurone2);

        neurone1.addLink(neurone3);
        neurone1.addLink(neurone4);

        neurone4.addLink(neurone5);
        neurone5.addLink(neurone6);

        neurone5.addLink(neurone2);
        neurone3.addLink(neurone5);

        cortex.addLink(neurone3);


        System.out.println(brain.getCortex().getChids(0, null));
        String code = brain.getCortex().getCode();
        System.out.println(code);
        Neurone newCortex = BrainBuilder.brainFromString(code);
        System.out.println(newCortex.getChids(0, null));
        //brain.getCortex().trigger("A");




    }

    public static Neurone neuroneBuilder(String cond) {
        Neurone neurone = new Neurone();
        neurone.setLinkCondition(cond);
        return neurone;
    }


}

